package aszm.chahaospider.parser.dytt;

import java.util.List;

import org.apache.log4j.Logger;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import aszm.chahaospider.constants.Constants;
import aszm.chahaospider.utils.Utils;

public class DyzzParser {
	private static final Logger Log = Logger.getLogger(DyzzParser.class.getName());

	/**
	 * 从网络获取电影专区
	 * 
	 * @param url
	 * @param writeDb
	 */
	public static void getDyzzFromWeb(String url, boolean writeDb) {
		Document doc = Utils.getDocumentDoc(url);
		Elements links = doc.select("div.co_content8 table");
		List<Object> Dyzz = parserDyzz(links);
		if (writeDb) {
			Log.info(links.size() + "开始写入 Shoujis ……");
			createFile(links);
		}
	}

	private static void createFile(Elements links) {

	}

	private static List<Object> parserDyzz(Elements links) {
		for (Element element : links) {
			Elements numbers = element.select("a");
			for (Element element1 : numbers) {
				String url = element1.attr("href").replaceFirst("/", Constants.YGDY8_URL);
				String number = element1.text();
				Log.debug(number + "==" + url);
			}
		}
		return null;
	}
}
